﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace MindASPCoreWebAPI.Repository.Migrations
{
    public partial class biao : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "admin_db",
                columns: table => new
                {
                    admin_id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    user_id = table.Column<int>(type: "int", nullable: false),
                    dic_id = table.Column<int>(type: "int", nullable: false),
                    admin_login_name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    admin_name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    admin_pwd = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    role_id = table.Column<int>(type: "int", nullable: false),
                    admin_status = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_admin_db", x => x.admin_id);
                });

            migrationBuilder.CreateTable(
                name: "admin_role_db",
                columns: table => new
                {
                    user_id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    role_id = table.Column<int>(type: "int", nullable: false),
                    admin_id = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_admin_role_db", x => x.user_id);
                });

            migrationBuilder.CreateTable(
                name: "dictionaries_db",
                columns: table => new
                {
                    dic_id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    dic_name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    dic_type = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    dic_status = table.Column<bool>(type: "bit", nullable: false),
                    dic_order = table.Column<int>(type: "int", nullable: false),
                    admin_id = table.Column<int>(type: "int", nullable: false),
                    dic_createdate = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_dictionaries_db", x => x.dic_id);
                });

            migrationBuilder.CreateTable(
                name: "role_db",
                columns: table => new
                {
                    role_id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    role_name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    role_status = table.Column<bool>(type: "bit", nullable: false),
                    role_createdate = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_role_db", x => x.role_id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "admin_db");

            migrationBuilder.DropTable(
                name: "admin_role_db");

            migrationBuilder.DropTable(
                name: "dictionaries_db");

            migrationBuilder.DropTable(
                name: "role_db");
        }
    }
}
